
<template>
  <div class="right" v-if="Object.keys(musicInfo).length">
    <div class="title">
      <div class="musicName">{{musicInfo.name}}</div>
      <div class="album" @click="goToDetailPage('album' ,musicInfo.al.id)">{{musicInfo.al.name}}</div>
      <div
        class="singer"
        @click="goToDetailPage('singerDetail' ,musicInfo.ar[0].id)"
      >{{musicInfo.ar[0].name}}</div>
    </div>
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: "topRight",
  props: {
    musicInfo: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  methods: {
    goToDetailPage(name, id) {
      this.$router.push({
        name,
        params: {
          id
        }
      });
      this.$store.commit("changeMusicDetailCardState", false);
    }
  }
};
</script>

<style scoped  >
.right {
  width: 350px;
}
.title {
  margin: 30px 0 15px;
  width: 100%;
  font-size: 12px;
  text-align: center;
  color: rgb(145, 145, 145);
}
.title div {
  margin: 7px 0;
}
.musicName {
  font-size: 23px;
  color: rgb(23, 23, 23);
}
.album,
.singer {
  cursor: pointer;
}
</style>
